﻿@using JT.WEB.Areas.Identity.Data
@using JTWEB3.Models
@inject SignInManager<JTWEB3User> SignInManager
@inject UserManager<JTWEB3User> UserManager
@inject JT.WEB.Service.IUserCenter UserCenter
<style>
    .dropdown .dropdown-menu {
        min-width: 7rem;
        background-color: #f9f9f9;
        padding: 0;
        left: 50%;
        transform: translateX(-50%);
    }
    .dropdown .dropdown-menu a:hover{
        background-color: #eee;       
    }
        .dropdown .dropdown-menu .dropdown-item {
            /*position: absolute;
        text-align: center;
        left: 50%;
        transform: translateX(-50%);*/
            /*background-color: #f9f9f9;
        
        box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);*/
            min-width: 7rem;
            line-height: 2rem;
        }
</style>
<ul class="nav justify-content-center" id="jtjc_login">
    @if (SignInManager.IsSignedIn(User))
    {
        <li class="nav-item dropdown">
            <a class="nav-link text-dark btn btn-link dropdown-toggle" data-toggle="dropdown" >
                消息
                @if (UserCenter.GetUnReadMSCount() > 0)
                {
                    <span class="badge badge-success">@UserCenter.GetUnReadMSCount()</span>

                }
            </a>
            <div class="dropdown-menu">
                <a class="nav-link text-dark dropdown-item" asp-area="JtSiteAdmin" asp-controller="Message"
                   asp-action="Index">系统消息 <span class="fa fa-commenting text-success"></span></a>
                <a class="nav-link text-dark dropdown-item" asp-area="JtSiteAdmin" asp-controller="Message"
                   asp-action="CommentReply">评论回复 <span class="fa fa-commenting-o text-success"></span></a>
                <a class="nav-link text-dark dropdown-item" asp-area="JtSiteAdmin" asp-controller="Message"
                   asp-action="WorkNotice">工作通知 <span class="fa fa-info text-success"></span></a>
                <a class="nav-link text-dark dropdown-item" asp-area="JtSiteAdmin" asp-controller="Message"
                   asp-action="AtMe"><span class="fa fa-at text-success"></span>我的</a>
            </div>
        </li>
        <li class="nav-item dropdown">
            @*asp-area="Identity" asp-page="/Account/Manage/Index"*@
            <a id="manage" class="nav-link text-dark btn btn-link dropdown-toggle" data-toggle="dropdown"> @UserManager.GetUserName(User)</a>
            <div class="dropdown-menu">
                @if (User.IsInRole("CaiWu"))
                {
                    <a class="nav-link text-dark dropdown-item" asp-area="" asp-controller="CaiWu"
                       asp-action="Index"><span class="fa fa-bar-chart"></span> 财务管理</a>
                }


                @if (User.IsInRole("Administrators"))
                {
                    <a class="nav-link text-dark dropdown-item" asp-area="" asp-controller="Users"
                       asp-action="Index"><span class="fa fa-user"></span> 用户管理</a>
                    <a class="nav-link text-dark dropdown-item" asp-area="" asp-controller="Role"
                       asp-action="Index"><span class="fa fa-user-plus"></span> 角色管理</a>
                }


                @if (User.IsInRole("WereHouse"))
                {
                    <a class="nav-link text-dark dropdown-item" asp-action="Index"
                       asp-controller="WereHouse" asp-area=""> <span class="fa fa-university"></span> 仓库管理</a>
                }

                <form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
                    <button id="logout" type="submit" class="nav-link btn btn-link text-dark dropdown-item"><span class="fa fa-power-off"></span> 退出登陆</button>
                </form>

            </div>
        </li>

    }
    else
    {
        <li class="nav-item">
            <a class="nav-link text-dark" id="register" asp-area="Identity" asp-page="/Account/Register" >注册</a>
        </li>
        <li class="nav-item">
            <a class="nav-link text-dark" id="login" asp-area="Identity" asp-page="/Account/Login">登陆</a>
        </li>
    }
</ul>
